Skip to content

An e-commerce API featuring JWT authentication for secure sessions, Stripe integration for payments, and core functionalities like user registration, product listings, shopping cart management, and dynamic inventory handling. Users can add products to carts, process payments, and create or edit products.

Notifications You must be signed in to change notification settings

NAJIB-B/simple-E-commerce-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple E-Commerce API

Overview

project architecture

A comprehensive e-commerce API that integrates JWT authentication for secure user sessions and Stripe for payment processing. It includes features such as user creation, shopping cart management, product listings, and the ability to create and edit products in the database. The API allows users to add products to a cart, handle payments via Stripe, and manage product inventory dynamically.

This API has the following features:

  • JWT authentication for secure user sessions
  • User registration and login
  • Shopping cart management
  • Integration with Stripe for payment processing
  • Product listings and detailed view
  • Ability to create new products
  • Edit existing products in the database
  • Manage product inventory dynamically
  • Handle user payments and update cart status

How to Run the Project

  1. Clone the project repo
  2. git clone https://github.com/NAJIB-B/simple-E-commerce-API.git
  3. Navigate into the project directory
  4. cd simple-E-commerce-API
  5. Install the dependencies
  6. npm install
  7. Create your own MongoDB database
  8. (I used MongoDB Atlas)

  9. I used mail trap and nodemailer for my email service. you can check them out on npm
  10. (So be sure to use those unless you want to edit the project and use something else)

  11. Create your .env file
  12. touch .env
  13. Add the following environment variables
  14. Populate the .env file with the following variables, replacing the placeholders with your own details:

    DATABASE="mongodb+srv://<username>:<password>@cluster0.mongodb.net/<database-name>?retryWrites=true&w=majority&appName=Cluster0"
    
    PORT=<port>
    JWT_SECRET=<your-access-token-secret>
    JWT_EXPIRES_IN=<time-for-expiry>
        
    MAIL_HOST=<your-mail-host>
    MAIL_PORT=<your-mail-port>
    MAIL_USERNAME=<your-mail-username>
    MAIL_PASSWORD=<your-mail-password>
    
    STRIP_API_KEY=<your-stripe-api-key>
    STRIPE_WEBHOOK_SECRET=<your-stripe-webhook-secret>
    
    
      
      

    Note:

  15. Run the project
  16. npm start

About

An e-commerce API featuring JWT authentication for secure sessions, Stripe integration for payments, and core functionalities like user registration, product listings, shopping cart management, and dynamic inventory handling. Users can add products to carts, process payments, and create or edit products.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published